﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Text.Json.Serialization;
using Utils;
using static DataModels.Enums.GeneralEnum;

namespace DataModels.Dto.Community
{
    public class SubmitServiceEvaluationInfo
    {
        /// <summary>
        /// 服务评价UUID
        /// </summary>
        [GeneralRequired]
        public Guid ServiceEvaluationUUID { get; set; }

        /// <summary>
        /// 项目UUID
        /// </summary>
        [GeneralRequired]
        public Guid? ProjectUUID { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Required]
        public string Title { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [Required]
        public string Content { get; set; }
    }

    /// <summary>
    /// 服务评价查询分页
    /// </summary>
    public class ServiceEvaluationInfo : PageRequest
    {
        public string Title { get; set; }

        public string ProjectUUID { get; set; }

        public Status? Status { get; set; }
    }


    [Serializable]
    public class surveyInfo
    {
        public string? title { get; set; }
        public string? description { get; set; }
        public DateTime? createTime { get; set; }
        public string? version { get; set; }
    }

    [Serializable]
    public class question
    {
        public question() 
        {
            options = new List<option>();
            inputs = new List<input>();
            candidates = new List<candidate>();
        }

        public string? id { get; set; }
        public string? type { get; set; }
        public string? title { get; set; }
        public bool? required { get; set; }
        public string? placeholder { get; set; }
        public int? maxLength { get; set; }
        public int? defaultValue { get; set; }
        public int? minRating { get; set; }
        public int? maxRating { get; set; }
        public string? voteTitle { get; set; }
        public string? description { get; set; }
        public string? voteType { get; set; }
        public int? maxSelect { get; set; }
        public bool? showResult { get; set; }
        public int? voteCount { get; set; }
        public int? totalVotes { get; set; }
        public int? participationRate { get; set; }

        public List<candidate> candidates { get; set; }
        public List<input> inputs { get; set; }
        public List<option> options { get; set; }
    }

    [Serializable]
    public class option
    {
        public string? value { get; set; }
        public string? text { get; set; }
        public string? label { get; set; }
        public string? title { get; set; }
        public bool? required { get; set; }
        public int? votes { get; set; }
        public int? percentage { get; set; }
    }

    [Serializable]
    public class input
    {
        public string? placeholder { get; set; }
        public int? maxLength { get; set; }
    }

    [Serializable]
    public class candidate
    {
        public string? name { get; set; }
        public string? description { get; set; }
        public string? avatar { get; set; }
        public int? votes { get; set; }
        public int? percentage { get; set; }
    }

    [Serializable]
    public class personalInfo
    {
        public string? name { get; set; }
        public string? phone { get; set; }
        public string? email { get; set; }
        public string? gender { get; set; }
        public string? date { get; set; }
        public string? time { get; set; }
        public int? age { get; set; }
        public string? education { get; set; }
    }

    public class ServiceEvaluationResponse
    {
        [JsonProperty("responses")]
        //public Dictionary<string, object> responses { get; set; }

        public JObject? responses { get; set; }
    }

    /// <summary>
    /// 服务评价内容Dto
    /// </summary>
    public class ServiceEvaluationContent
    {
        public ServiceEvaluationContent() 
        {
            surveyInfo = new surveyInfo();
            questions = new List<question>();
            personalInfo = new personalInfo();
        }

        public surveyInfo? surveyInfo { get; set; } 
        public List<question>? questions { get; set; }
        public personalInfo? personalInfo { get; set; }
        public object? responses { get; set; }
        //public JObject? responses { get; set; }
    }


}
